#!/usr/bin/expect -f

set timeout 600
set password "{{ opengauss_admin_password }}"

spawn su - {{ opengauss_user }} -c "{{ gaussdb_tool_path }}/script/gs_install -X {{ tmp_tar_packages_path }}/cluster_config_template.xml \
--gsinit-parameter=\"--encoding=UTF8\" \
--gsinit-parameter=\"--lc-collate=C\" \
--gsinit-parameter=\"--lc-ctype=C\" \
--gsinit-parameter=\"--dbcompatibility={{ panweidb_dbcompatibility }}\" -l {{ tmp_tar_packages_path }}/gs_install.log"

# Warnings: Cannot change `--dbcompatibility=A` to `--dbcompatibility=B`. There may be a bug; see this issue on Gitee.(https://gitee.com/opengauss/openGauss-OM/issues/IA8WOA?from=project-issue).

expect "Please enter password for database:"
send "$password\r"

expect "Please repeat for database:"
send "$password\r"

expect eof
